package com.yunhuakeji.wddx.control;

import java.io.InputStream;
import net.sf.json.JSONObject;
import com.opensymphony.xwork2.ActionSupport;
import com.yunhuakeji.wddx.service.TicketAppService;
import com.yunhuakeji.wddx.service.TicketService;
import com.yunhuakeji.wddx.utils.ResultUtil;

public class TicketController extends ActionSupport
{
	private static final long serialVersionUID = 1L;
	private InputStream inputStream;
	private String callback,userid,ticket;
	
	public String createTicket(){
		
		inputStream = new ResultUtil().resultString(callback, JSONObject.fromObject("{\"ticket\":\"" + new TicketService().addTicket(userid) + "\"}"));
		
		return SUCCESS;
	}
	
	public String createAppTicket(){
		
		inputStream = new ResultUtil().resultString(callback, JSONObject.fromObject("{\"ticket\":\"" + new TicketAppService().addTicket(userid) + "\"}"));
		
		return SUCCESS;
	}
	
	public InputStream getInputStream() {
		return inputStream;
	}
	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}
	public String getUserid() {
		return userid;
	}
	public void setUserid(String userid) {
		this.userid = userid;
	}
	public String getTicket() {
		return ticket;
	}
	public void setTicket(String ticket) {
		this.ticket = ticket;
	}

	public String getCallback() {
		return callback;
	}

	public void setCallback(String callback) {
		this.callback = callback;
	}
}
